package com.sdtv.basemodule.widget.gloading;

import android.view.View;

import com.billy.android.loading.Gloading;

/**
 * @ProjectName: MediunFusion
 * @Package: com.sdtv.basemodule.widget.gloading
 * @ClassName: GloadingAdapter
 * @Description: Gloading状态view显示
 * @Author: 小郭同学
 * @CreateDate: 2019-06-20 09:33
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class GloadingAdapter implements Gloading.Adapter {
    @Override
    public View getView(Gloading.Holder holder, View convertView, int status) {
        switch (status) {
            case StatusConstant.STATUS_LOADING:
                //加载中view
                convertView = new GloadingLoadingView(holder.getContext());
                break;
            case StatusConstant.STATUS_LOAD_SUCCESS:
                //加载数据成功
                convertView = new GloadingSuccessView(holder.getContext());
                break;
            case StatusConstant.STATUS_LOAD_FAILED:
                //加载数据失败
                convertView = new GloadingErrorView(holder.getContext(), holder.getRetryTask(), StatusConstant.STATUS_LOAD_FAILED);
                break;
            case StatusConstant.STATUS_EMPTY_DATA:
                // 位加载到数据
                convertView = new GloadingEmptyView(holder.getContext());
                break;
            case StatusConstant.STATUS_NETWORK_ERROR:
                // 网络异常
                convertView = new GloadingErrorView(holder.getContext(), holder.getRetryTask(), StatusConstant.STATUS_NETWORK_ERROR);

                break;


        }
        return convertView;
    }
}
